﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" Culture="th-TH" uiCulture="th" AutoEventWireup="true" CodeBehind="MP_CountryZones.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.MP_CountryZones" %>
<%@ Register Src="~/APP_UI/UserControls/MAS_Countries.ascx" TagName="MP_Countries" TagPrefix="uc1" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>
<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <title>ข้อมูลภูมิภาค/ประเทศ</title>
    
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">        
            <script type="text/javascript">
                function CollapseSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.collapse();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.collapse();
                    }
                }
                function ExpandSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.expand();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.expand();
                    }
                }

                function closeRadWindow(sender, args) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest('CloseWindow');
                }

                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
 
            </script>
        
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmdSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdExpand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1"
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdCollapse">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel5" />
                    <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                    <telerik:AjaxUpdatedControl ControlID="lblZoneSeq" />   
                    <telerik:AjaxUpdatedControl ControlID="Panel4" />                 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>                
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel4">
                <UpdatedControls>                                     
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    <asp:panel ID="Panel6" runat="server" CssClass="contentPanelPaddingTop5px">
    <table width="1000" cellpadding="0" cellspacing="0">

        <tr>
            <td width="280">
               <!-- <uc2:user ID="user1" runat="server" /> -->
            </td>
            <td width="10" >
            </td>
            <td valign="top" width="700" rowspan="2" >
                <div class="Background980V3" style="width: 690px; min-height: 420px; padding: 8px 0px 8px 8px; margin-left: 5px"> 
                        <asp:Panel ID="Panel5" runat="server" >
                            <table align="center" width ="100%" >
                                <tr>
                                    <td align="left" class="tableHeader">
                                        <asp:Label ID="lblHeader" runat="server" Font-Bold="True"></asp:Label>
                                        <asp:Label ID="lblZoneSeq" runat="server" Visible ="false" ></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <asp:Panel ID="Panel4" runat="server" Height="370px" ScrollBars="Auto" 
                            Width="100%">
                            <table align="center">
                                <tr>
                                    <td>
                                        <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" 
                                            AllowFilteringByColumn="True" AllowMultiRowEdit="True" 
                                            AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" 
                                            AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True" 
                                            GridLines="None" OnItemCommand="RadGrid1_ItemCommand" ShowStatusBar="true" 
                                            Skin="Outlook" Width="100%">
                                            <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" 
                                                CommandItemDisplay="Top" DataKeyNames="Sequence" 
                                                InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                                <CommandItemTemplate>
                                                    <table cellpadding="0" cellspacing="0" width="600px">
                                                        <tr>
                                                            <td>
                                                                <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                                                    CommandName="InitInsert" 
                                                                    Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>">
                                                                <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                                                    style="border:0px;vertical-align:middle;" /> เพิ่มข้อมูลใหม่</asp:LinkButton>
                                                                &nbsp;&nbsp;
                                                            </td>
                                                            <td align="right">
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </CommandItemTemplate>
                                                <Columns>
                                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                                                        EditText="คลิกเพื่อแก้ไขข้อมูล">
                                                        <ItemStyle HorizontalAlign="Center" Width="10px" />
                                                    </telerik:GridEditCommandColumn>
                                                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
                                                        ConfirmDialogType="RadWindow" ConfirmText="ลบข้อมูลที่เลือก?" 
                                                        Text="คลิกเพื่อลบข้อมูล" UniqueName="column1">
                                                        <HeaderStyle HorizontalAlign="Center" Width="10px" />
                                                        <ItemStyle HorizontalAlign="Center" Width="10px" />
                                                    </telerik:GridButtonColumn>
                                                    <telerik:GridBoundColumn DataField="Sequence" DataType="System.Int32" 
                                                        Display="False" HeaderText="Sequence" ReadOnly="True" UniqueName="Sequence" 
                                                        Visible="False">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                        CurrentFilterFunction="Contains" DataField="Name" FilterControlWidth="100%" 
                                                        ShowFilterIcon="False" UniqueName="Name">
                                                        <HeaderStyle Width="250px" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                        CurrentFilterFunction="Contains" DataField="NameEng" FilterControlWidth="100%" 
                                                        HeaderText="ชื่อภาษาอังกฤษ" ShowFilterIcon="False" UniqueName="NameEng">
                                                        <HeaderStyle Width="250px" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                        CurrentFilterFunction="Contains" DataField="Remarks" FilterControlWidth="100%" 
                                                        HeaderText="หมายเหตุ" ShowFilterIcon="False" UniqueName="Remarks">
                                                        <HeaderStyle Width="100px" />
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                                <EditFormSettings EditFormType="WebUserControl">
                                                    <EditColumn UniqueName="EditCommandColumn1">
                                                    </EditColumn>
                                                </EditFormSettings>
                                                <PagerStyle AlwaysVisible="true" FirstPageToolTip="กลับหน้าแรก" 
                                                    LastPageToolTip="ไปหน้าสุดท้าย" Mode="NextPrevNumericAndAdvanced" 
                                                    NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                                    PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                            </MasterTableView>
                                            <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" 
                                                EnableRowHoverStyle="True" ReorderColumnsOnClient="True">
                                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                            </ClientSettings>
                                        </telerik:RadGrid>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div> 
            </td>
        </tr>
        <tr>
            <td width="400" valign="top">
                <div class="Background980V3" style="width: 280px; height: 420px; padding: 8px 8px 8px 8px;"> 
                        <asp:Panel ID="Panel1" Visible="False" runat="server" Width="280px" ScrollBars="Auto">
                        <table style="border-bottom-style: double; border-color: #008080" width ="100%">
                                <tr>
                                    <td >
                                        &nbsp;&nbsp; ค้นหา :&nbsp;
                                    </td>
                                    <td >
                                        <telerik:RadTextBox ID="txtSearch" Runat="server">
                                        </telerik:RadTextBox>
                                        <asp:ImageButton ID="cmdSearch" runat="server" onclick="cmdSearch_Click" 
                                            ToolTip="กดปุ่มเพื่อเริ่มค้นหาข้อมูล" 
                                            ImageUrl="~/App_UI/Images/Buttons/Magnifier.gif" />
                                        &nbsp;
                                        <!-- <asp:ImageButton ID="cmdExpand" runat="server" 
                                            ImageUrl="../Images/Buttons/ExpandAll.gif" onclick="cmdExpand_Click" 
                                            ToolTip="ขยายทั้งหมด" Height="20px" />
                                        &nbsp;
                                        <asp:ImageButton ID="cmdCollapse" runat="server" 
                                            ImageUrl="../Images/Buttons/CollapseAll.gif" onclick="cmdCollapse_Click" 
                                            ToolTip="ย่อทั้งหมด" Height="20px" /> -->
                                    </td>
                                </tr>
                            </table>
                            
                        </asp:Panel>
                        <asp:Panel ID="Panel2" runat="server" Width="100%" Height="100%" ScrollBars="Auto">
                            <telerik:RadTreeView Runat="server" 
                                ID="RadTreeView1" 
                                DataFieldID="Id" 
                                DataFieldParentID="Parent_id" 
                                DataTextField="Name" 
                                DataValueField="Id" 
                                EnableDragAndDrop="True"
                                onnodeclick="RadTreeView1_NodeClick" 
                                CausesValidation="False" 
                                onnodeexpand="RadTreeView1_NodeExpand" 
                                onnodedrop="RadTreeView1_NodeDrop">
                            </telerik:RadTreeView>
                        </asp:Panel> 
                </div>
            </td>
            <td width="10">
            </td>
        </tr>
        
    </table>
    </asp:panel></asp:Content>
